package cn.tedu.cwfw.ff.controller;

import cn.tedu.cwfw.base.response.JsonResult;
import cn.tedu.cwfw.client.pojo.vo.ClientVO;
import cn.tedu.cwfw.ff.pojo.dto.FfQuery;
import cn.tedu.cwfw.ff.pojo.dto.FfSaveParam;
import cn.tedu.cwfw.ff.pojo.vo.FfVO;
import cn.tedu.cwfw.ff.service.FfService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/cwfw/ff")
public class FfController {
    @Autowired
    FfService ffService;

    @PostMapping("insert")
    public JsonResult saveFf(FfSaveParam ffSaveParam){
        log.debug("关注用户信息：ffSaveParam={}",ffSaveParam);
        ffService.insertFf(ffSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("delete/{fansId}")
    public JsonResult deleteFf(@PathVariable Long fansId){
        log.debug("删除关注信息：id={}",fansId);
        ffService.deleteFf(fansId);
        return JsonResult.ok();
    }
    @GetMapping("selectFollow")
    public JsonResult selectFf(FfQuery ffQuery){
        log.debug("查询关注信息：ffQuery={}",ffQuery);
        List<FfVO> list = ffService.selectFf(ffQuery);
        return JsonResult.ok(list);
    }
    @GetMapping("selectFans")
    public JsonResult selectFans(FfQuery ffQuery){
        log.debug("查询粉丝信息：ffQuery={}",ffQuery);
        List<FfVO> list = ffService.selectFans(ffQuery);
        return JsonResult.ok(list);
    }
}
